<template>
  <div>
    <el-form ref="form" :model="form" label-width="80px">
      <el-form-item label="发信人">
        <el-input class="w500" v-model="form.orther_info.from_user_name" ></el-input>
      </el-form-item>
      <el-form-item label="收信人">
        <el-input class="w500" v-model="form.orther_info.to_user_name" ></el-input>
      </el-form-item>
      <el-form-item label="信件标题">
        <el-input class="w500" v-model="form.title" ></el-input>
      </el-form-item>
      <el-form-item label="信件内容">
        <el-input class="w500" type="textarea" :rows="5" v-model="form.content" ></el-input>
      </el-form-item>
      <el-form-item>
        <el-button @click="goBack">返回</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
  import { mapState } from 'vuex'

  export default {
    data () {
      return {
      }
    },
    computed: {
      ...mapState({
        form: state => state.inmail.mailInfo
      })
    },
    async created () {
      await this.mailInfo()
    },
    methods: {
      async mailInfo () {
        let payload = {
          id: this.$route.params.id
        }
        await this.$store.dispatch('inmail/mailInfo', payload)
      },
      goBack () {
        this.$router.go(-1)
      }
    }
  }
</script>
